package com.ddd.mill.query.attribute;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ddd.mill.domain.aggregate.attribute.entity.Attribute;
import com.ddd.mill.api.attribute.dto.response.AttributeListDto;
import com.ddd.mill.infrastructure.utils.TypeConvertUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import com.ddd.mill.infrastructure.persistent.dao.attribute.AttributeDao;

import java.util.List;


/**
 * @author liu
 * @title: AttributeQueryServiceMyBatisServiceImpl
 * @projectName trading-center
 * @date 2020/11/3016:18
 */
@Slf4j
@Service
public class AttributeQueryServiceMyBatisServiceImpl extends ServiceImpl<AttributeDao, Attribute> implements AttributeQueryService {


    @Override
    public List<AttributeListDto> getAttributeList(Long attributeTypeId) {
        QueryWrapper queryWrapper = new QueryWrapper();
        queryWrapper.eq("attribute_type_id", attributeTypeId);
        return TypeConvertUtils.convert(this.list(queryWrapper), AttributeListDto.class);
    }
}
